package com.zheng.hospital.service.controller;

import com.zheng.hospital.common.result.CommonResult;
import com.zheng.hospital.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/api/oss/file")
public class OssController {
    @Autowired
    OssService ossService;

    /**
     * 上传文件到oss
     * @param file
     */
    @PostMapping("/fileUpload")
    public CommonResult fileUpload(MultipartFile file) {
        String url = ossService.upload(file);
        return CommonResult.ok(url);
    }
}
